package cn.wolfcode.crm.web.interceptor;

import cn.wolfcode.crm.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcJavaConfig implements WebMvcConfigurer {
    @Autowired
    private PermissionInterceptor permissionInterceptor;
    @Autowired
    private LoginInterceptor loginInterceptor;

    public void addInterceptor(InterceptorRegistry registry){
        registry.addInterceptor(loginInterceptor).addPathPatterns("/**")//拦截的路径
                .excludePathPatterns("/css/**","/js/**","/loginUser.do","/login.html");//排除的路径
        registry.addInterceptor(permissionInterceptor).addPathPatterns("/**")
                .excludePathPatterns("/css/**","/js/**","/loginUser.do","/login.html");

    }
}
